package com.lancoo.klgcourseware.ui.fragment.more;

import android.os.Bundle;
import androidx.annotation.Nullable;
import android.text.Html;
import android.view.View;
import android.widget.TextView;

import com.lancoo.klgcourseware.R;
import com.lancoo.klgcourseware.base.BaseKlgFragment;

public class MoreTranslationFragment extends BaseKlgFragment {

    private TextView mTvTranslation;

    public static MoreTranslationFragment newInstance(String translation) {

        MoreTranslationFragment fragment = new MoreTranslationFragment();
        Bundle bundle = new Bundle();
        bundle.putString("extra_translation",translation);
        fragment.setArguments(bundle);
        return fragment;
    }

    @Override
    protected void initView(View view) {
        mTvTranslation = view.findViewById(R.id.tv_translation);
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        Bundle bundle = getArguments();
        if (bundle != null){
            String rawTranslation = bundle.getString("extra_translation","");
            mTvTranslation.setText(Html.fromHtml(rawTranslation));
        }
    }

    @Override
    protected int getContentViewId() {
        return R.layout.klg_fragment_more_translation;
    }
}
